package com.kaifamiao.month04.day06;

public class ObjectTest {

    public static void main(String[] args) throws CloneNotSupportedException {
        Person p = new Person();
        p.name = "杨洋";
        Pet pet = new Pet();
        pet.name = "汪汪";
        p.pet = pet;
        System.out.println(p);
        System.out.println(p.clone()); // 两个person不是同一个对象
        System.out.println(p.pet);
        System.out.println(((Person)p.clone()).pet); // 两个pet不是同一个对象
    }
}
